import request from '@/utils/request'

/**
 * 获取所有活动
 * @param params 值
 * @returns {AxiosPromise}
 */
export function getActivitieListApi(params) {
  return request({
    url: '/api/Activities',
    method: 'GET',
    headers: {
      isToken: true,
      Accept: 'application/json'
    },
    params: Object.assign(params)
  });
}

/**
 * 获取单个活动
 * id 值
 * @returns {AxiosPromise}
 */
export function getActivitieIdApi(id) {
  return request({
    url: `/api/Activities/${id}`,
    method: 'GET',
    headers: {
      isToken: true,
      Accept: 'application/json'
    }
  });
}

/**
 * 添加活动
 *  @param data 参数
 */
export function CreationActivitieApi(data) {
  return request({
    url: '/api/Activities',
    method: 'POST',
    headers: {
      'Content-Type': 'application/json', // 添加 Content-Type 头部
      'Accept': 'application/json'
    },
    data
  });
}

/**
 * 更新活动
 *  @param data 参数
 *  id 参数
 */
export function UpdateActivitieApi(data, id) {
  return request({
    url: `/api/Activities/${id}`,
    method: 'PUT',
    headers: {
      'Content-Type': 'application/json',
      'Accept': 'application/json'
    },
    data
  });
}

/**
 * 删除活动
 * @param data 数据
 */
export function activitieDeleteApi(id) {
  return request({
    url: `/api/Activities?activityIds=${id}`,
    method: 'DELETE',
  });
}

/**
 * 部分更新
 * @param id
 */
export function patchActivitieApi(ids, data) {
  return request({
    url: `/api/Activities?activityIds=${ids}`,
    method: 'PATCH',
    data
  });
}
